import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux'
import {Redirect, Route, Switch} from 'react-router'
import {HashRouter} from 'react-router-dom'
import moment from 'moment'
import 'moment/locale/zh-cn'
import {ConfigProvider} from 'antd'
import ZH_CN from 'antd/es/locale/zh_CN'
import 'antd/dist/antd.less'

import store from './store'

import RouterApp from './components/routerApp'
import 'animate.css/animate.css'
import './static/scss/common.scss'
import LoginApp from './components/user/loginApp'
import NotFound from './components/notFound/notFound'
import ViewerApp from "./components/fileViewer/viewerApp";

// const LoginApp = lazy(() => import('./components/user/loginApp'));
// const NotFound = lazy(() => import('./components/notFound/notFound'));
// const ViewerApp = lazy(() => import('./components/fileViewer/viewerApp'));

moment.locale('zh_cn')

ReactDOM.render(
    <Provider store={store}>
        <ConfigProvider locale={ZH_CN}>
            <HashRouter>
             {/* <Suspense fallback={<div style={{width: '100%', height: '100%', background: '#FCF9F2'}}/>}> */}
                <Switch>
                    <Route path="/" exact render={() => <Redirect to={'/view'}/>}/>
                    <Route path="/view" component={props => <RouterApp {...props}/>}/>
                    <Route path="/viewer" component={props => <ViewerApp {...props}/>}/>
                    <Route path="/login" component={props => <LoginApp {...props}/>}/>
                    <Route path="*" component={props => <NotFound {...props}/>}/>
                    </Switch>
              {/* </Suspense> */}
            </HashRouter>
        </ConfigProvider>
    </Provider>,
    document.getElementById('cloudMap')
);